package com.guoxiang.bigdata.download.impl;

import com.guoxiang.bigdata.download.Downloader;
import com.guoxiang.bigdata.util.HttpUtil;

public class BaidutiebaDownload implements Downloader {


    /**
     * 下载百度贴吧的页面
     * @param url 页面地址
     * @return 返回页面的字符串
     */
    @Override
    public String  download(String url) {
        //在测试环境下每下载一页休眠1秒
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        String html = HttpUtil.simpledDownload(url);
        if(html!=null){
            //成功下载页面
            return html;
        }
        return null;
    }
}
